import unittest

from FluidClass.FluidSettings import FluidSettings
from ResistanceClass.StraightCircleFlowSharpSpikeRestriction import StraightCircleFlowSharpSpikeRestriction as pype
from ResistanceClass.ResistanceAbstractClass import ResistanceAbstractClass as RAC


# Вводим значения длины трубы и диаметра (СИ)
length = 1
diameter_inlet = 0.1
diameter_outlet = 0.05
superclass = pype(FluidSettings(), length, diameter_inlet, diameter_outlet)

# Вводим значения из Экселя, меняем запятые на точку
Reynolds = 28484.106146
Lambda = 0.02458
PressureDrop = 115.9820601
Velocity = 0.510828303
area = 0.001963495
Total_Resistance = 0.89161

# Точность (оптимально от 2 до 4)
quality = 4


class GeneralParameters(unittest.TestCase):

    def test1_Reynolds(self):
        self.assertEqual(round(superclass.reynolds_number(), quality), round(Reynolds, quality))

    def test2_Lambda(self):
        self.assertEqual(round(superclass.resistance_coefficient_lambda(), quality), round(Lambda, quality))

    def test3_PressureDrop(self):
        self.assertEqual(round(superclass.pressure_drop(), quality), round(PressureDrop, quality))

    def test4_Velocity(self):
        self.assertEqual(round(superclass.velocity(), quality), round(Velocity, quality))

    def test5_AreaInlet(self):
        self.assertEqual(round(superclass.area_inlet(), quality), round(area, quality))

    def test6_AreaOutlet(self):
        self.assertEqual(round(superclass.area_outlet(), quality), round(area, quality))

    def test7_Total_Resistance(self):
        self.assertEqual(round(superclass.total_resistance_coefficient(), quality), round(Total_Resistance, quality))


if __name__ == '__main__':
    unittest.main()
